import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const router = new Router({
    mode: 'history',
    routes: [
        {
            meta: { title: '登录/注册 clew++手工艺品展示平台' },
            path: '/login',
            name: 'Login',
            component: () => import('@/pages/Login')
        },
        {
            path: '/',
            name: 'HomePage',
            component: () => import('@/pages/HomePage'),
            redirect: "/home",
            children: [
                {
                    meta: { title: 'HomePage for clew++手工艺品展示', activeMenu:'/home' },
                    path: 'home',
                    name: 'Home',
                    component: () => import('@/pages/SliderBottom')
                },
                {
                    meta: { title: '作品欣赏', activeMenu: '/works' },
                    path: 'works',
                    name: 'Works',
                    component: () => import('@/pages/WorksExhibit')
                },
                {
                    meta: { title: '作品咨询', activeMenu: '/consult' },
                    path: 'consult',
                    name: 'Consult',
                    component: () => import('@/pages/Consultation')
                },
            ]
        },

    ]
})

// 后置路由守卫
router.afterEach((to, from) => {
    document.title = to.meta.title
});


export default router;